<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
<h1>JavaScript Example 7</h1>
<br>
Shows how to use the <code>isNaN</code> and <code>isFinite</code> functions<br>
<br>
<hr>
<br>

<!-- SCRIPT STARTS HERE -->

<script type="text/javascript">
	// declare a variable
	var value1,value2,result;
	// use isNaN() loops to make sure that the value entered can be 
	// converted to a number
	// enter the following combinations: 4-2 , 4-0; 0-0
	while (isNaN(value1)) value1 = window.prompt("Enter the first number:");
	while (isNaN(value2)) value2 = window.prompt("Enter the second number:");
	
	//value1 = parseInt(value1);
	//value2 = parseInt(value2);
	
	result = value1/value2;
	if (isNaN(result)) document.writeln("The result is not defined");
	else {
		if (isFinite(result)) document.writeln("The result is " + result);
		else document.writeln("The result is <strong>infinite<strong>");
	}

</script>

<!-- SCRIPT ENDS HERE -->

</body>
</html>
